<!--
  This file is a part of the open-eBackup project.
  This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0.
  If a copy of the MPL was not distributed with this file, You can obtain one at
  http://mozilla.org/MPL/2.0/.
  
  Copyright (c) [2024] Huawei Technologies Co.,Ltd.
  
  THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND,
  EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
  MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
  -->

<lv-form [formGroup]="formGroup" [lvLabelColon]="false" class="formGroup">
  <div>
    <lv-form-item>
      <lv-form-label lvRequired>{{nameLabel}}</lv-form-label>
      <lv-form-control [lvErrorTip]="clusterNameErrorTip">
        <input lv-input type="text" formControlName="clusterName"
          placeholder="{{'system_backup_member_node_placeholder_label' | i18n }}" />
      </lv-form-control>
    </lv-form-item>
    <lv-form-item>
      <lv-form-label lvRequired>
        {{ipLabel}}
      </lv-form-label>
      <lv-form-control [lvErrorTip]="baseUtilService.ipErrorTip">
        <input lv-input type="text" formControlName="ip" placeholder="{{'system_ip_placeholder_label'| i18n }}" />
      </lv-form-control>
    </lv-form-item>
    <lv-form-item>
      <lv-form-label lvRequired>
        {{portLabel}}
      </lv-form-label>
      <lv-form-control [lvErrorTip]="portErrorTip">
        <input lv-input type="text" formControlName="port" placeholder='1~65535' />
      </lv-form-control>
    </lv-form-item>
    <lv-form-item *ngIf="!modifyMemberNode">
      <lv-form-label lvRequired>
        {{userNameLabel}}
      </lv-form-label>
      <lv-form-control [lvErrorTip]="usernameErrorTip">
        <input lv-input type="text" formControlName="username" autocomplete="new-password"
          placeholder="{{'system_node_username_placeholder_label' | i18n}}" />
      </lv-form-control>
    </lv-form-item>
    <lv-form-item *ngIf="!modifyMemberNode">
      <lv-form-label [lvRequired]="changedName">{{passwordLabel}}</lv-form-label>
      <lv-form-control [lvErrorTip]="passwordErrorTip">
        <aui-inupt-with-eye formControlName="password" placeholder="{{'system_node_passwd_placeholder_label' | i18n}}">
        </aui-inupt-with-eye>
      </lv-form-control>
    </lv-form-item>
  </div>
</lv-form>

<ng-template #headerTpl>
  <div class="lv-modal-title">
    {{(drawData ? 'common_modify_label': 'common_create_label') | i18n}}
    <i lv-icon="aui-icon-help" [lv-tooltip]="nodeTipTpl" lvTooltipPosition="rightTop"
       class="configform-constraint info-icon" lvColorState='true'></i>
  </div>
</ng-template>

<ng-template #nodeTipTpl>
  <span innerHTML="{{'system_backup_member_node_tip_label' | i18n}}" class="name-tooltip"></span>
</ng-template>
